#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#define N 10 
int bin_search(int arr[], int n,int key);
int main()
{
	int m = 0;
	int j = 0;
	int arr[N] = { 0,1,2,3,4,5,6,7,8,9 };
	printf("Input numbers:\n");
	scanf("%d", &m);
	j = bin_search(arr, N,m);
	if (j != -1)
	{
		
		printf("%d", arr[j]);
	}
	else
	{
		printf("Not found\n");
	}
	return 0;
}
int bin_search(int arr[], int n,int key)
{
	
	int left = 0;
	int right = n - 1;
	int mid = 0;
	while (left <= right)
	{
		mid = (left +right)/ 2;
		if (arr[mid] > key)
		{
			right = mid - 1;
		}
		else if (arr[mid] < key)
		{
			left = mid + 1;
		}
		else
		{
			return mid;
		}
	}
	return -1;
}